<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <title>Document</title>
</head>
<body>
<div id="app">
    <home></home>
</div>
<script src="./vue.js"></script>
<script>
    const CommonTitle = {
        template: `
          <div>
          <h3>这是子组件头部</h3>
          <slot title="静态数据" :msg="msg" :arr="arr"></slot>
          <h3>子组件底部</h3>
          </div>
        `,
        data() {
            return {
                msg: '这是子组件数据',
                arr: ['a', 'b', 'c', 'd']
            }
        }
    }
    Vue.component('Home', {
        template: `
          <div>
          <h2>我是home</h2>
          <common-title>
            <div slot-scope="data">
              {{ data.msg }}
              <br/>
              {{ data.title }}
              <br/>
              {{ data.arr }}
            </div>
          </common-title>

          </div>
        `,
        components: {
            CommonTitle
        }
    })
    const vm = new Vue({
        el: '#app'
    })
</script>
</body>
</html>